{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import neurokit2 as nk\n",
    "\n",
    "# Download example data\n",
    "data = nk.data(\"bio_eventrelated_100hz\")\n",
    "\n",
    "# Preprocess the data (filter, find peaks, etc.)\n",
    "processed_data, info = nk.bio_process(ecg=data[\"ECG\"], rsp=data[\"RSP\"], eda=data[\"EDA\"], sampling_rate=100)\n",
    "\n",
    "# Compute relevant features\n",
    "results = nk.bio_analyze(processed_data, sampling_rate=100)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import neurokit2 as nk\n",
    "\n",
    "# Generate synthetic signals\n",
    "ecg = nk.ecg_simulate(duration=10, heart_rate=70)\n",
    "ppg = nk.ppg_simulate(duration=10, heart_rate=70)\n",
    "rsp = nk.rsp_simulate(duration=10, respiratory_rate=15)\n",
    "eda = nk.eda_simulate(duration=10, scr_number=3)\n",
    "emg = nk.emg_simulate(duration=10, burst_number=2)\n",
    "\n",
    "# Visualise biosignals\n",
    "data = pd.DataFrame({\"ECG\": ecg,\n",
    "                     \"PPG\": ppg,\n",
    "                     \"RSP\": rsp,\n",
    "                     \"EDA\": eda,\n",
    "                     \"EMG\": emg})\n",
    "nk.signal_plot(data, subplots=True, standardize=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Generate 15 seconds of ECG signal (recorded at 250 samples/second)\n",
    "ecg = nk.ecg_simulate(duration=15, sampling_rate=250, heart_rate=70)\n",
    "\n",
    "# Process it\n",
    "signals, info = nk.ecg_process(ecg, sampling_rate=250)\n",
    "\n",
    "# Visualise the processing\n",
    "nk.ecg_plot(signals, info)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
